package com.dvj.demo.mbp.gen;

import lombok.Builder;
import lombok.Data;
import lombok.experimental.Tolerate;

/**
 * GenInfo
 * 代码生成配置
 * TODO 继续完善参数配置、自定义模板
 *
 * @author Dvj
 * @date 2021/5/26 11:55
 */
@Data
@Builder
public class GenInfo {

    private static final String CONSTRUCT = "/src/main/java";

    /**
     * 模块绝对路径 (模块右键 Copy Path)
     */
    private String projectPath = "D:\\GitHub\\spring-boot-demo\\demo-mybatis-plus";

    /**
     * 作者
     */
    private String author = "Dvj";

    /**
     * 数据库连接
     */
    private String url = "jdbc:mysql://localhost:3306/wheel_mall?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai";
    private String driverName = "com.mysql.jdbc.Driver";
    private String userName = "root";
    private String password = "my3306sql";
    private String dbName = "admin";

    /**
     * 是否生成 controller 与 service
     */
    private Boolean genController = true;
    private Boolean genService = true;

    /**
     * controller service 包名
     */
    private String controllerPackageName = "com.dvj.demo.mbp.gen.controller";
    private String servicePackageName = "com.dvj.demo.mbp.gen.service";
    private String serviceImplPackageName = "com.dvj.demo.mbp.gen.service.impl";

    /**
     * dao包名
     */
    private String entityPackageName = "com.dvj.demo.mbp.gen.model.pojo";
    private String mapperPackageName = "com.dvj.demo.mbp.gen.dao.mapper";
    private String xmlPackageName = "com.dvj.demo.mbp.gen.dao.mapping";

    /**
     * 表前缀
     */
    private String tablePrefix = "t";

    /**
     * 是否覆盖已存在的文件
     */
    private Boolean overrideExistFile = true;

    /**
     * 添加函数或者构造方法，让lombok假装它不存在（不感知）。
     * 解决lombok使用@Builder不能使用空构造器的问题
     */
    @Tolerate
    public GenInfo() {
    }


    public String getProjectPath() {
        return projectPath + CONSTRUCT;
    }
}
